package org.jash.learnmvp.user;

import org.jash.learnmvp.entity.CodeEntity;
import org.jash.learnmvp.entity.LoginEntity;
import org.jash.learnmvp.mvp.BaseModel;

import java.util.HashMap;

import io.reactivex.rxjava3.core.Observable;

public class CodeLoginModel extends BaseModel implements ConStruct.ICodeLoginModel {
    @Override
    public Observable<CodeEntity> getLCode(String phone) {
        return service.getLCode(phone);
    }

    @Override
    public Observable<LoginEntity> login(String phone, String code) {
        return service.codeLogin(new HashMap<String, String>() {{
            put("phone", phone);
            put("code", code);
        }});
    }

    @Override
    public Observable<LoginEntity> logout() {
        return service.logout();
    }
}
